﻿//Copyright (C) <2013>  <jonathan cleeve norton> All Rights Reserved 
//Contact jon.norton@fin-plus.co.uk website <http://www.fin-plus.co.uk/>
using System;
using FinPlusCompCore;

namespace FinPlusCompQuant
{
    public class FixedRateBondForward : FinPlusComponent
    {
        public QLNet.FixedRateBond FixedRateBond { get; private set; }

        //construct
        public FixedRateBondForward(string marketName, string fwdBondName, string bondName, string repoCurveName, string bondCurveName, double price, DateTime settlementDate, int deliveryDate, int settlementDays, string repoConv, string bondConv, string holidays)
        {
            var market = Markets.Instance.GetMarket(marketName);
            var bond = market.GetBond(bondName);

		    var bondCurve = market.GetLinkedCurve(bondCurveName);
		    var repoCurve =  market.GetLinkedCurve(repoCurveName);
				
		    //FixedRateBond = market.GetBonds(bondName);  
		    //bond->setPricingEngine(boost::shared_ptr<PricingEngine>(new DiscountingBondEngine(bondCurve)));

		    //fwdBonds[marketName][fwdBondName] = boost::shared_ptr<QuantLib::Forward>(new QuantLib::FixedRateBondForward(settleDate, delDate, Position::Long, price, settlementDays, DayCount(repoConv), Holidays(holidays), BizConv(bondConv), bond, repoCurve, repoCurve));
        }
    }
}
